package com.ranjiaqi.homework;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

/**
 * @ClassName FirstAnswer
 * @Description TODO
 * @Author hp
 * @Date 2021/6/25 18:04
 * @Version 1.0
 **/
public class FirstAnswer {
    public static void main(String[] args) {
        method();
    }

    public  static  void  method(){
        HashMap<String, Integer> m1 = new HashMap<>();
        m1.put("张三",800);
        m1.put("李四",1500);
        m1.put("王五",3000);
        m1.put("张三",2600);
        System.out.println(m1);
        for (String s : m1.keySet()){
            int value = m1.get(s);
            m1.put(s,value+100);
        }
        Set<Map.Entry<String, Integer>> entries = m1.entrySet();
        Iterator<Map.Entry<String,Integer>> iterator = entries.iterator();
        while (iterator.hasNext()){
            Map.Entry<String, Integer> next = iterator.next();
            System.out.println(next.getKey()+"的工资为"+next.getValue());
        }
    }
}
